#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_exam1.py
# author:王雯雯
# datetime:2024-11-12 
# software: PyCharm

import requests
import os

url = "https://cn.bing.com/images/search?view=detailV2&ccid=hGUOgiMQ&id=39EF6342280BB38ED0B9B5ED6248DED2AEC1BD27&thid=OIP.hGUOgiMQfymgzhOyGkvEtQHaEK&mediaurl=https%3a%2f%2fp6.itc.cn%2fimages01%2f20211121%2f38fdff18fe1341009a3c5597159cfd9a.png&exph=1080&expw=1920&q=%e5%a4%a9%e5%ae%98%e8%b5%90%e7%a6%8f&simid=608001047389295118&FORM=IRPRST&ck=BEDB6044E845280CBE3F5B0E66CF5317&selectedIndex=0&itb=0"  # 替换为实际的图片网络地址
save_path = "D:/path/to/save/image.jpg"  # 替换为想要保存的具体路径

# 发送HTTP GET请求获取图片资源
response = requests.get(url)
if response.status_code == 200:
    with open(save_path, "wb") as f:
        f.write(response.content)
    print("图片下载并保存成功")
else:
    print("下载图片失败")
